package org.example.actualcombat.demos.web.modules.pms.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.example.actualcombat.demos.web.common.api.CommonPage;
import org.example.actualcombat.demos.web.common.api.CommonResult;
import org.example.actualcombat.demos.web.modules.pms.model.PmsBrand;
import org.example.actualcombat.demos.web.modules.pms.service.PmsBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/brand")
public class PmsBrandController {
    @Autowired
    PmsBrandService brandService;
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult getBrand(@RequestParam(value="keyword",defaultValue = "") String keyword,
                                 @RequestParam(value="pageNum",defaultValue = "1") Integer pageNum,
                                 @RequestParam(value="pageSize",defaultValue = "5") Integer pageSize){
        Page<PmsBrand> page =  brandService.list(keyword,pageNum,pageSize);
        return CommonResult.success(CommonPage.restPage(page));
    }
}
